<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
 <head>
  <title>I Brew tests</title>

  <link rel="stylesheet" href="css/brewgear.css" type="text/css" />

  <script type="text/javascript" src="js/jquery-1.4.js"></script>

  <script type="text/javascript" src="js/gears_init.js"></script>
  <script type="text/javascript" src="js/gears_wrapper.js"></script>

  <script type="text/javascript" src="js/brewgear.jquery.js"></script>
  <script type="text/javascript" src="js/brewgear.math.js"></script>
  <script type="text/javascript">
  $(function() {
    $('#test-sg_to_plato').append(sg_to_plato(1050));
    $('#test-sg_to_brix').append(sg_to_brix(1050));
    $('#test-srm_to_ebc').append(srm_to_ebc(50));
    $('#test-ebc_to_srm').append(ebc_to_srm(132.1));
    $('#test-bitterness_tinseth').append(bitterness_tinseth(56, { alpha: 5, pellets: false }, FACTOR_BITTER_HOPPING, 60, 20, 1050));
    $('#test-bitterness_rager').append(bitterness_rager(56, { alpha: 5, pellets: false }, FACTOR_BITTER_HOPPING, 60, 20, 1050));
    $('#test-bitterness_daniels').append(bitterness_daniels(56, { alpha: 5, pellets: false }, FACTOR_BITTER_HOPPING, 60, 20, 1050));

    $('.multistate').multistate();
    //console.log($('#datetest1').field());
    //console.log($('#datetest2').field());

    $('#test-sum').text($('#test-math > table td:nth-child(3) > input').sum());

/*

 */
 
    MyClass = {
      caller: function(callback) {
        callback('hi');
      },
      dbtest: function(callback) {
        db = openDatabase('brewgear');    
        db.transaction(function(tx) {
          tx.executeSql('select style_id, name from style where name like ?', [ '%%' ], function(tx, rs) {
            for (var i = 0; i < rs.rows.length; i++) {
              var field = rs.rows.item(i);
              console.log(i + ' of ' + rs.rows.length + ' - name: ' + field.name + ', style_id: ' + field.style_id);
              $('#styles').append('<tr><td>' + field.name + '</td></tr>');
              callback(i);
            }
          });
        });
      }
    }
  
    MyClass.dbtest(function(msg) {
      $('#caller').text(msg);
    });
  });
  </script>
 <head>
 <body>
  <div id="ui-wrapper">
<button name="ferm-added" class="multistate" rel="mash:maisch,boil:koken,ferm:vergisting" value="mash"></button>
    <button class="multistate" rel="xaap:xaap,xnoot:xnoot,xmies:xmies"></button>
   <div id="test-math">
    <table>
     <tr><th>function</th><th>parameters</th><th>expected</th><th>result</th></tr>
     <tr><td>sg_to_plato</td><td>1050</td><td><input type="text" value="12.4" /></td><td id="test-sg_to_plato" /></tr>
	     <tr><td>sg_to_brix</td><td>1050</td><td><input type="text" value="12.9" /></td><td id="test-sg_to_brix" /></tr>
		     <tr><td>srm_to_ebc</td><td>50</td><td><input type="text" value="132.1" /></td><td id="test-srm_to_ebc" /></tr>
			     <tr><td>ebc_to_srm</td><td>132.1</td><td><input type="text" value="50" /></td><td id="test-ebc_to_srm" /></tr>
				     <tr><td>bitterness_tinseth</td><td>56, 5, bitter, 60, 20, false</td><td><input type="text" value="50" /></td><td id="test-bitterness_tinseth" /></tr>
					     <tr><td>bitterness_rager</td><td>56, 5, bitter, 60, 20, false</td><td><input type="text" value="50" /></td><td id="test-bitterness_rager" /></tr>
						     <tr><td>bitterness_daniels</td><td>56, 5, bitter, 60, 20, false</td><td><input type="text" value="50" /></td><td id="test-bitterness_daniels" /></tr>
     </table>
     <p id="test-sum">no sum</p>
   </div>
   <button class="multistate" rel="aap:aap,noot:noot,mies:mies"></button>
   <input type="text" class="date" id="datetest1" value="13-12-07" /> <span id="datetest1out" ></span>
   <input type="text" class="date" id="datetest2" value="29-02-2008" /> <span id="datetest2out" ></span>
  </div>
  
  <table id="styles">
  </table>
  <p id="caller" />
 </body>
</html>
